﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using DTO;
using BUS;

namespace BanSach
{
    public partial class frmKhachHang : Form
    {
        public frmKhachHang()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            string makh = textBox3.Text;
            string tenkh = textBox4.Text;
            string diachi = textBox5.Text;
            string sdt = textBox6.Text;
            int sl = int.Parse(textBox7.Text);
            KhachHang_DTO kh = new KhachHang_DTO(makh, tenkh, diachi, sdt, sl);
            KhachHang_BUS.ThemKhachHang(kh);
            dataGridView1.DataSource = KhachHang_BUS.LoadKhachHang();
        }

        private void button3_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = KhachHang_BUS.LoadKhachHang();
        }

        private void button5_Click(object sender, EventArgs e)
        {
            KhachHang_BUS.XoaKhachHang(textBox2.Text);
            dataGridView1.DataSource = KhachHang_BUS.LoadKhachHang();
        }

        private void button4_Click(object sender, EventArgs e)
        {
            dataGridView1.DataSource = KhachHang_BUS.TimTen(textBox1.Text);
        }
    }
}
